package com.his.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.his.api.service.SectionService;
import com.his.dao.domain.dto.ListDto;
import com.his.dao.domain.entity.Section;
import com.his.dao.domain.vo.ListVo;
import com.his.dao.mapper.SectionMapper;
import com.his.util.result.RestResult;
import com.his.util.result.RestResultBuilder;
import com.his.util.util.MapUtil;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fall
 * @since 2022-11-28
 */
@Service
@AllArgsConstructor
public class SectionServiceImpl extends ServiceImpl<SectionMapper, Section> implements SectionService {
    private SectionMapper sectionMapper;

    @Override
    public RestResult allId(Section section) {
        QueryWrapper<Section> queryWrapper = new QueryWrapper<Section>()
                .select("section_id", "name")
                .like(section.getName() != null,"name",section.getName())
                .eq(section.getHospitalId() != null,"hospital_id",section.getHospitalId());
        return new RestResultBuilder().success(sectionMapper.selectList(queryWrapper));
    }
}
